﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GenesisOne
{
    class Sprite
    {
        Texture2D texture;
        Rectangle? sourceRectangle = null;
        Vector2 position;

        public Sprite(Vector2 position, Rectangle? sourceRectangle)
        {
            this.position = position;
            this.sourceRectangle = sourceRectangle;
        }

        public Sprite(int x, int y, Rectangle? sourceRectangle)
        {
            this.position = new Vector2(x, y);
            this.sourceRectangle = sourceRectangle;
        }
        
        public Vector2 Position
        {
            get { return position; }
            set { this.position = value; }
        }

        public Texture2D Texture
        {
            get { return texture; }
            set { this.texture = value; }
        }

        public Rectangle? SourceRectangle
        {
            get { return sourceRectangle; }
            set { this.sourceRectangle = value; }
        }
       
        public void LoadContent(ContentManager Content, string assetName)
        {
            texture = Content.Load<Texture2D>(assetName);
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, new Vector2(position.X, position.Y), sourceRectangle, Color.White);            
        }
    }
}
